/**
 * Created by zhangsong on 2019-01-18.
 */
const Dbf = require('../model/dbf');

function createByMulti(obj) {
  return Dbf.bulkCreate(obj);
}

function createRecord({
  date,
  point,
  temperature,
}) {
  return Dbf.create({
    date,
    point,
    temperature,
  });
}

function findByPoint({point}) {
  return Dbf.findAll({
    attributes: ['date', 'point', 'temperature'],
    where: {
      point,
    },
    order: [
      ['date', 'ASC'],
    ],
  })
}

module.exports = {
  createRecord,
  createByMulti,
  findByPoint,
};
